//
//  HStore.h
//  TestOCRedux
//
//  Created by Hotacool on 2019/1/17.
//  Copyright © 2019 Hotacool. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HReducer.h"

@protocol HSubscriberType <NSObject>
- (void)stateChanged:(id)newState action:(id<HActionType>)action;
@end

@interface HStore <StateType> : NSObject
@property (nonatomic, strong, readonly) StateType state;

+ (HStore*)generateWithReduce:(HReducer)reduce state:(StateType)state;

- (void)dispatch:(id<HActionType>)action;

- (void)subscribe:(id<HSubscriberType>)subscriber;

- (void)subscribe:(id<HSubscriberType>)subscriber specifySubState:(NSString*)subStateName;

- (void)unSubscribe:(id<HSubscriberType>)subscriber;
@end
